package ru.ifmo.swing;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import javax.swing.*;

/**
 * @author avhaliullin
 */
public class ApplicationStarter {
    public static void main(String[] args) {
        if (args.length < 1) {
            throw new RuntimeException("First parameter should contain spring config file name");
        }
        ApplicationContext context = new FileSystemXmlApplicationContext(args[0]);
        BeanFactory factory = (BeanFactory) context;
        JFrame mainFrame = (JFrame) factory.getBean("mainFrame");
        mainFrame.setVisible(true);
    }
}
